#include <filesystem>
#include <iostream>
#include <string>
#include <numeric>

namespace fs = std::filesystem;

namespace impl
{
uint64_t get_directory_size(const fs::path& dirpath,
                            bool const follow_symlinks = false)
{
    auto it = fs::recursive_directory_iterator(
        dirpath,
        follow_symlinks ? fs::directory_options::follow_directory_symlink
                        : fs::directory_options::none);
    return std::accumulate(fs::begin(it),
                           fs::end(it),
                           0ull,
                           [](uint64_t const total,
                              fs::directory_entry const& entry) {
                               return total + (fs::is_regular_file(entry)
                                                   ? fs::file_size(entry.path())
                                                   : 0);
                           });
}
}  // namespace impl

using namespace std;
int main(int argc, char** argv)
{
    string path;
    cout << "Input Path:\n";
    cin >> path;
    cout << "Size:" << impl::get_directory_size(path) << '\n';
    return 0;
}